//
//  UIImage+HBCategory.h
//  HBLibary
//
//  Created by Rambo on 2018/10/26.
//

#import <UIKit/UIKit.h>

@interface UIImage (HBCategory)

/**
 layer转换成Image
 
 @param layer layer
 @return image
 */
+ (UIImage *)hb_imageWithLayer:(CALayer*)layer;


/**
 设置图片透明度
 
 @param alpha 透明度
 @param image 图片
 @return 新图片
 */
+ (UIImage *)hb_imageByApplyingAlpha:(CGFloat)alpha image:(UIImage*)image;


/**
 标识符
 */
@property (nonatomic, copy) NSString *hb_identifier;

/**
 图片切圆
 */
+ (UIImage *)hb_carveRoundedCornersWithImage:(UIImage*)image;


/**
 保存图片

 @param image 图片
 @param saveHandle 保存回调
 @param statusHandle 相册权限回调，没有权限的时才有回调
 */
+ (void)hb_saveImage:(UIImage*)image saveHandle:(void(^)(BOOL success, NSError * _Nullable error))saveHandle statusHandle:(void(^)(void))statusHandle;


/**
 压缩图片
 
 @param KByte KByte
 */
- (NSData*)hb_compressKByte:(NSInteger)KByte;
@end
